// pages/person/person.js
Page({
  data: {
    userInfo:''
  },
  onLoad()
  {
    let user = wx.getStorageSync('user')
    this.setData({
      userInfo:user
    })
    console.log('缓存:',user);
  },
  //登陆授权
  login(e)
  {
    wx.getUserProfile({
      desc: '要你的信息',
      success:res=>{
        // console.log(res.userInfo);
        let user = res.userInfo
        //缓存到本地
        wx.setStorageSync('user', user)
        this.setData({
          userInfo:user
        })
      },
      fail:err=>{
        console.log(err);
      }
    })
  },
  //推出登陆
  loginOut()
  {
    this.setData({
      userInfo:''
    })
    wx.setStorageSync('user', null)
  },
  jumpsetup(e)
  {
    wx.navigateTo({
      url: `/pages/setup/setup`,
    })
  },
  jumpaddress()
  {
    wx.navigateTo({
      url: '/pages/address/address',
    })
  }
})